package com.gwtapps.multisearch.client;

import java.util.ArrayList;
import java.util.Iterator;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.gwtapps.multisearch.client.view.MultiSearchView;
import com.gwtapps.multisearch.client.view.MultiSearchViewListener;

public class MultiSearch implements EntryPoint, MultiSearchViewListener{
	ArrayList searchers = new ArrayList();
	
	public void onModuleLoad() {
		MultiSearchView view = new MultiSearchView( this );
		RootPanel.get("multiSearchView").add( view );
		searchers.add( new YouTubeSearcher( view ) );
		//searchers.add( new YahooSearcher( view ) );

	}
	
	public void onSearch( String query ){
		for( Iterator it = searchers.iterator(); it.hasNext(); ){
			Searcher searcher = (Searcher)it.next();
			searcher.query( query );
		}
	}
}
